$OpenBSD: patch-tombupnp_threadutil_src_ThreadPool_c,v 1.4 2013/01/27 14:13:30 brad Exp $
--- tombupnp/threadutil/src/ThreadPool.c.orig	Thu Mar 25 10:58:13 2010
+++ tombupnp/threadutil/src/ThreadPool.c	Sun Jan 27 08:51:59 2013
@@ -141,7 +141,8 @@ SetPolicyType( PolicyType in )
 static int
 SetPriority( ThreadPriority priority )
 {
-#if defined(HAVE_SCHED_GET_PRIORITY_MIN) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING > 0)
+  && defined(HAVE_SCHED_GET_PRIORITY_MIN) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
     int currentPolicy;
     int minPriority = 0;
     int maxPriority = 0;
@@ -372,8 +373,8 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff
     gettimeofday( &t, NULL );
 #if defined(WIN32)
     srand( ( unsigned int )(t.tv_usec/1000) + (unsigned int)ithread_get_current_thread_id(  ).p );
-#elif defined(__FreeBSD__) || defined (__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__)
-    srand( ( unsigned int )(t.tv_usec/1000) + (unsigned int)ithread_get_current_thread_id(  ) );
+#elif defined(HAVE_ARC4RANDOM)
+    srand( arc4random() );
 #else
     srand( ( unsigned int )(t.tv_usec/1000) + ithread_get_current_thread_id(  ) );
 #endif
